function [errf, errOC  ] = calcSelfCalibError(answerF,answerloc,ks,numdifff)

if(nargin<4)
    numdifff=0;
end

[m,n]=size(ks);

if(n==0) % this is when we dont knwo the intrinsic parameters
    disp('no intrinsic parameters provided');
    errf=answerF(1,1);
    errOC=answerloc;
    
else
    
    
    trueF1=0;
    trueF2=0;
    trueX=0;
    trueY=0;
    countr=0;
    for i=(1+numdifff):n
        trueF1=trueF1+abs(ks{1,i}(1,1));
        trueF2=trueF2+abs(ks{1,i}(2,2));
        
        trueX= trueX+abs(ks{1,i}(1,3));
        trueY=trueY+abs(ks{1,i}(2,3));
         countr= countr+1;
    end
    
    
    trueF1=trueF1/countr;
    trueF2=trueF2/countr;
    
    trueX= trueX/countr;
    trueY=trueY/countr;
    
    
    f1err=(abs(answerF(1,1)-trueF1)/trueF1);
    f2err=(abs(answerF(1,2)-trueF2)/trueF2);
    
    xerror=(abs(trueX-answerloc(1,1)))/trueX;
    yerror=(abs(trueY-answerloc(1,2)))/trueY;
    
    errf=((f1err+f2err)/2)*100;
    
    errOC=((xerror+yerror)/2)*100;
    
    if(errf>200)
        errf=200;
    end
    
    if(errOC>200)
        errOC=200;
    end
end
end